﻿using System.Collections.Generic;
using WPTrek.Data.Space;

namespace WPTrek.Data.Stub
{
    public class StubGalaxyFactory : IGalaxyFactory
    {
        public int GalaxiesCount { get; private set; }

        public StubGalaxyFactory(int galaxiesCount)
        {
            GalaxiesCount = galaxiesCount;
        }

        #region IGalaxyFactory Members

        public IEnumerable<IGalaxy> Create()
        {
            List<IGalaxy> result = new List<IGalaxy>();

            for (int i = 0; i < GalaxiesCount; ++i)
            {
                var galaxy = new Galaxy("Galaxy" + i.ToString());
                StubSectorFactory sectorFactory = new StubSectorFactory(4, galaxy);

                var sectors = sectorFactory.Create();
                galaxy.AddSectors(sectors);

                result.Add(galaxy);
            }

            return result;
        }

        #endregion
    }
}
